package com.wtx.security.config;

import com.wtx.security.vo.SysUserVO;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

public class MyUser extends User {

    /**
     * 我们自己的用户实体对象，要调取用户信息时直接获取这个实体对象
     */
    private SysUserVO sysUserVO;

    public MyUser(SysUserVO sysUserVO, Collection<? extends GrantedAuthority> authorities) {
        super(sysUserVO.getUsername(), sysUserVO.getPassword(), authorities);
        this.sysUserVO = sysUserVO;
    }

    public SysUserVO getSysUserVO() {
        return sysUserVO;
    }

    public void setSysUserVO(SysUserVO sysUserVO) {
        this.sysUserVO = sysUserVO;
    }
}
